<?php

require_once "include/config.php";
require_once "include/functions.php";

$random_open_subtitles = get_random_open_subtitles('3');

for ($i = 0; $i <= count($random_open_subtitles)-1; $i++) {
if($random_open_subtitles[$i]['is_favourite_video']=="1")
{
$video_info = get_favourite_video_information($random_open_subtitles[$i]['video_id']);
}
else
{
$video_info = get_video_information($random_open_subtitles[$i]['video_id']);
}
$video_title = $video_info['name'];
$lang_name = get_language_by_id($random_open_subtitles[$i]['language']);
$lang_name = $lang_name['name'];

$mod_user_information = get_user_info();


echo "
<div id='main-container' style='width:100%;'>

<div style='clear:left;'>
<div style='float:left;'><b>Title:&nbsp;</b></div>
<div style='float:left;'>".$random_open_subtitles[$i]['title']."</div>
</div>


<!--
<div style='clear:left;'>
<div style='float:left;'><b>Video:&nbsp;</b></div>
<div style='float:left;'>".$video_title."</div>
</div>

-->

<div style='clear:left;'>
<div style='float:left;'><b>Lang:&nbsp;</b></div>
<div style='float:left;'>".$lang_name."</div>
</div>


<div style='clear:left;'>
<div style='float:left;'><b>Done:&nbsp;</b></div>
<div style='float:left;'>".get_subtitle_progress($random_open_subtitles[$i]['table_name'])."%</div>
</div>


<div style='clear:left;'>
<div style='float:left;'><b>Join:&nbsp;</b></div>
<div style='float:left;'>";

if(is_user_loggedin()=="true")
{
echo "<a href='index.php?page=requests&user_id=".$mod_user_information['id']."&subtitle_id=".$random_open_subtitles[$i]['id']."&request=yes'>click here to join the subtitle team</a>";
}
else
{
echo "<a href='index.php?page=signin'>login</a>";
}

echo "</div>
</div>

</div>

<div style='clear:both;'></div>

";

if($i < count($random_open_subtitles)-1) echo "<hr>";
}

?>

